<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no" />
    <title>Document</title>
    <style>
        div {
            width: 4rem;
            height: 4rem;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>

    <script>
        (function() {
            window.onresize = function() {
                var width = window.innerWidth;

                // if (width >= 750) {
                //     width = 750;
                // }
                width = Math.min(width, 750);
                // if (width <= 320) {
                //     width = 320;
                // }
                width = Math.max(width, 320);

                document.documentElement.style.fontSize = width / 15 + "px";
            };

            window.onresize();
        })();
    </script>
</body>

</html>